<template>
  <div>
    <el-row>
      <el-col :span="24">
        <h5>小U商城后台</h5>
        <!-- default-active:默认展开的菜单对应的index -->
        <!-- router:默认不开启，开启后点击菜单会跳转到index对应的页面去 -->
        <!-- unique-opened：只展开一个菜单 -->
        <el-menu
          :default-active="$route.path"
          :unique-opened="true"
          :router="true"
          class="el-menu-vertical-demo"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
          <el-menu-item index="/index">
            <i class="el-icon-setting"></i>
            <span slot="title">首页</span>
          </el-menu-item>
          <el-submenu index="2">  
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>系统设置</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/index/menu">菜单管理</el-menu-item>
              <el-menu-item index="/index/role">角色管理</el-menu-item>
              <el-menu-item index="/index/admin">管理员管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="3">  
            <template slot="title">
              <i class="el-icon-s-goods"></i>
              <span>商城管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item
                v-for="(item,index) in menuList"
                :key="index"
                :index="'/index'+item.path"
              >{{item.name}}</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      menuList: [
        {name: '商品分类', path: '/category'},
        {name: '商品规格', path: '/specs'},
        {name: '商品管理', path: '/goods'},
        {name: '会员管理', path: '/member'},
        {name: '轮播图管理', path: '/banner'},
        {name: '秒杀活动', path: '/seckill'}
      ]
    }
  },
};
</script>

<style>
</style>